package com.gugee.ins.common.dal.mapper.dic;

import com.gugee.common.mapper.GugeeMapper;
import com.gugee.ins.common.model.mysql.dic.InsDicCategory;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * ins博主分类字典表 Mapper 接口
 * </p>
 *
 * @author yzz
 * @since 2020-12-30
 */
public interface InsDicCategoryMapper extends GugeeMapper<InsDicCategory> {

    @Select("select overall_category overallCategory from ins_dic_category group by overall_category order by overrall_category")
    List<InsDicCategory> findDistinctAll();

    /**
     * 获取所有一级分类
     * @return
     */
    @Select("select overall_category from ins_dic_category group by overall_category ")
    List<String> findAllOverallCategory();

    /**
     * 根据二级分类获取一级分类
     * @param category
     * @return
     */
    @Select("select overall_category from ins_dic_category where category = #{category} ")
    String findOverallCategoryByCategory(String category);
}
